﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using System.Reflection;
using K.EnterpriseLibary.Entity;
namespace K.Persistence.Interface
{
    public interface IUser
    {
        void CreateUserInfo(UserInfo userInfo);
        int UpdateUserInfo(UserInfo userInfo);
        void DeleteUserInfo(UserInfo userInfo);
        UserInfo SelectUserInfoByPrimaryKey (params object[] parameters);
        UserInfo SelectUserInfoByUniqueKey(params object[] parameters);
        //UserInfo SelectUserInfoByAnyProperty(params object[] parameters);
        List<UserInfo> SelectUserInfoByAnyProperty(params object[] parameters);
        List<UserInfo> SelectUserInfoList(params object[] parameters);
    }
    public sealed partial class DataAccess
    {
        public static IUser CreateUser()
        {
            string className = path + ".UserDao";
            object objType = K.EnterpriseLibary.Common.DataCache.GetCache(className);
            if (objType == null)
            {
                try
                {
                    objType = Assembly.Load(path).CreateInstance(className);
                    K.EnterpriseLibary.Common.DataCache.SetCache(className, objType);// 写入缓存
                }
                catch { }
            }
            return (IUser)objType;

        }
    }
}
